#pragma once

#include <string>
#include <list>
#include <ostream>

namespace frame {
namespace imp {

class WriteBuffer {
public:
    void pushBack(const std::string & str);
    void pushBack(std::string && str);
    void pushBack(const char * cstr);
    void pushBack(const char * buf, size_t len);
    void popBack();
    const std::string & front() const;
    const std::string & back() const;
    void clear();
    size_t size() const {
        return data.size();
    }

    typedef std::list<std::string>::const_iterator const_iterator;
    const_iterator begin() const {
        return data.cbegin();
    }
    const_iterator end() const {
        return data.cend();
    }
private:
    std::list<std::string> data;
};

std::ostream & operator<<(std::ostream & os, const WriteBuffer & wb);

} //end of namespace imp
} //end of namespace  frame
